import request from '@/utils/request';

export interface LoginType {
  name: string;
  password: string;
}
export interface UserId {
  UserId: string;
}
/**
 * 获取登录Token
 * @param params
 * @returns
 */
export async function GetUserToken(params: LoginType) {
  console.log('Simple====');
  return request('/api/user/login', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取个人信息(带上token直接获取)
 * @param params
 * @returns
 */
export async function GetUserInfo() {
  return request('/api/user/viewBaseInfo', {
    method: 'POST',
    // data: params,
  });
}

export async function userList(params: any) {
  return request('/api/system/userList', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取角色
 * @param params
 * @returns
 */
export async function GetUserRoleByUserId(params: UserId) {
  return request('/mmsapi/authorityservice/UserRoleQuery/GetUserRoleByUserId', {
    method: 'POST',
    data: params,
  });
}

/**
 * 获取权限
 * @param params
 * @returns
 */
export async function GetPersmissionByUserId(params: UserId) {
  return request('/mmsapi/authorityservice/UserQuery/GetPersmissionByUserId', {
    method: 'POST',
    data: params,
  });
}

export async function ReLogin(params: LoginType) {
  console.log('Simple====');
  return request('/api/system/reLoin', {
    method: 'POST',
    data: params,
  });
}
